﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// DefaultValueTextCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class DefaultValueTextCtrl : UserControl
    {

        #region Variables

        #endregion

        #region Constructor
        public DefaultValueTextCtrl()
        {
            InitializeComponent();
        }

        #endregion

        #region Properties

        #endregion

        #region 依赖属性



        public string DefaultValue
        {
            get { return (string)GetValue(DefaultValueProperty); }
            set { SetValue(DefaultValueProperty, value); }
        }

        // Using a DependencyProperty as the backing store for DefaultValue.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty DefaultValueProperty =
            DependencyProperty.Register("DefaultValue", typeof(string), typeof(DefaultValueTextCtrl), new PropertyMetadata(""));



        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(DefaultValueTextCtrl), new PropertyMetadata(""));



        #endregion

        #region Event

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers

        private void _tx_LostFocus(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(Text))
            {
                _tb.Visibility = Visibility.Visible;
            }
            else
            {
                _tb.Visibility = Visibility.Collapsed;
            }
        }

        private void _tx_GotFocus(object sender, RoutedEventArgs e)
        {
            _tb.Visibility = Visibility.Collapsed;
        }

        #endregion


    }
}
